﻿using Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IService
{
    public interface IPurchaseOrderService
    {
        /// <summary>
        /// 新增进货订单（含明细）
        /// </summary>
        /// <param name="order">主表实体</param>
        /// <param name="details">明细列表</param>
        /// <returns>是否新增成功</returns>
        Task<bool> AddPurchaseOrderWithDetailsAsync(PurchaseOrderEntity order, List<WmsOrderDetails> details);

        /// <summary>
        /// 显示进货订单的数据
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="pageSize"></param>
        /// <param name="purchaseOrderNo"></param>
        /// <param name="status"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        Task<PagedViewModel<PurchaseOrderDTO>> GetPurchaseOrdersAsync(
        int currentPage, int pageSize,
        string? purchaseOrderNo, string? status,
        DateTime? startDate, DateTime? endDate);

        /// <summary>
        /// 获取订单详情（主表+明细）
        /// </summary>
        /// <param name="orderNo"></param>
        /// <returns></returns>
        Task<PurchaseOrderDetailAggregateDTO> GetPurchaseOrderDetailAsync(string orderNo);

        Task UpdateReview(string code, string txt, string status);

        Task BatchUpdateReview(List<string> orderNos, string status, string opinion, string reviewer);

        Task<PagedViewModel<PurchaseOrderMainDTO>> GetRelatedOrdersAsync(
            string inboundType, List<string> status, int? supplierId, string? orderNo,
            string? purchaser, string? department, string? date, int page, int size);

        Task<(PurchaseOrderMainDTO main, List<PurchaseOrderDetailDTO> details)> GetOrderWithDetailsAsync(string orderNo);

        Task<PagedViewModel<PurchaseOrderDetailDTO>> GetOrderGoodsAsync(
            string orderNo, string? codeOrName, string? unit, int page, int size);

    }
}
